package de.koller.so.gl.obj;

import de.koller.oceanFramework.gl.util.ParticleTexture;
import de.koller.oceanFramework.gl.util.TextureUtil;
import org.lwjgl.opengl.GL11;

abstract public class Texture {

	private ParticleTexture texture;
	private int anisotrophic = -1;
	
	abstract protected ParticleTexture generate();
	
	public final ParticleTexture getTexture() {
		if( texture == null )
			texture = generate();
		return texture;
	}
	
	public final void bindAnisotrophic() {
		if( anisotrophic == -1 )
			anisotrophic = TextureUtil.makeAnisotropic( getTexture() );
		GL11.glBindTexture( GL11.GL_TEXTURE_2D, anisotrophic );
	}
	
}
